/*localStorage的方法 
    存： localStorage.setItem('key',value)
    取:  localStorage.getItem('key')
    删:  localStorage.removeItem('key')
    清空：localStorage.celar()

*/
const HMKEY ='heima-toutiao'

//1.存token
function saveToken(obj){
    localStorage.setItem(HMKEY,JSON.stringify(obj))
}

//2.取
function getToken(){
    return JSON.parse( localStorage.getItem(HMKEY) )
}
//3.删
function removeToken(){
     localStorage.removeItem(HMKEY)
}
//导出接口
export{saveToken,getToken,removeToken}